package com.mymall.serve.interceptor;

import com.mymall.serve.pojo.bo.LoginUserBO;

/**
 * 存储当前登录用户信息
 *
 * @author weiwei
 * @since 2020-04-11 21:50
 **/
public class RequestThreadLocal {
    private static final ThreadLocal<LoginUserBO> LOCAL_LOGIN_USER = new ThreadLocal<>();

    public static void addUser(LoginUserBO loginUserBO) {
        LOCAL_LOGIN_USER.set(loginUserBO);
    }

    public static void remove() {
        LOCAL_LOGIN_USER.remove();
    }

    public static LoginUserBO getLoginUser() {
        return LOCAL_LOGIN_USER.get();
    }

    public static Long getUserId() {
        return 0L;
    }
}
